package com.example.zuuldemo.config;

import org.springframework.cloud.netflix.zuul.filters.discovery.PatternServiceRouteMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * 拿着我们的访问路径去按照正则匹配一个服务
 *
 * @author 文希
 * @create 2019-05-26 14:16
 */
@Component
public class ZuulRouteConfig {

    @Bean
    public PatternServiceRouteMapper getPatternServiceRouteMapper() {
        return new PatternServiceRouteMapper("(?<name>.*)", "${name}");
    }
    // (?<name>.*)-(?<service>v.*$) 那个服务
    // ${version}/${name} 访问怎么样的路径
    // user-service -> user-service 里面走

}
